<?php if(!defined('BASEPATH')) exit("Sorry, what you're looking not found.");
class C_validasi extends Nvl_Controller{
    function __construct(){
        parent::__construct();
        session_start();
		$this->__checkSession();
        $this->load->model('m_validasi');
    }

    function index(){
        $this->load->view('pages/v_validasi');
    }

    function get_list(){
        $pagenum = $this->input->get('pagenum');
        $pagesize = $this->input->get('pagesize');
		$start = $pagenum * $pagesize;
		$search_text = $this->input->get('search_text');
		$result = $this->m_validasi->get_list($start, $pagesize, $search_text);
		echo $result;
    }
    function get_list_detail(){
		$prestasi_id = $this->input->numeric('prestasi_id', 'get');
		$result = $this->m_validasi->get_list_detail($prestasi_id);
		echo $result;
    }
	
	function save(){
		$params = json_decode($this->input->post("params"));
		extract(get_object_vars($params));
		$count = count($detail);
		for($i=0; $i<$count; $i++){
			if($detail[$i]->prestasi_id != ''){
				$this->db->where('prestasi_id',$detail[$i]->prestasi_id)->update('t_prestasi', array('prestasi_valid'=>$detail[$i]->prestasi_valid));
			}
		}
		echo 1;
	}
}